import request from '../../utils/request';

// 道具管理相关 API

// 更新道具
export const updateProp = (data: any) => {
    return request({
        url: '/member/api/prop',
        method: 'put',
        data
    });
};

// 创建道具
export const createProp = (data: any) => {
    return request({
        url: '/member/api/prop',
        method: 'post',
        data
    });
};

// 根据ID获取道具
export const getPropById = (id: string) => {
    return request({
        url: `/member/api/prop/${id}`,
        method: 'get'
    });
};

// 删除道具
export const deleteProp = (id: string) => {
    return request({
        url: `/member/api/prop/${id}`,
        method: 'delete'
    });
};

// 根据ID获取道具(包含所有语言版本)
export const getPropByIdAllLanguages = (id: string) => {
    return request({
        url: `/member/api/prop/${id}/all-languages`,
        method: 'get'
    });
};

// 删除道具国际化信息
export const deletePropI18n = (propId: string, language: string) => {
    return request({
        url: `/member/api/prop/${propId}/i18n/${language}`,
        method: 'delete'
    });
};

// 根据代码查询道具
export const getPropByCode = (propCode: string) => {
    return request({
        url: `/member/api/prop/code/${propCode}`,
        method: 'get'
    });
};

// 更新道具国际化信息
export const updatePropI18n = (data: any) => {
    return request({
        url: '/member/api/prop/i18n',
        method: 'put',
        data
    });
};

// 创建道具国际化信息
export const createPropI18n = (data: any) => {
    return request({
        url: '/member/api/prop/i18n',
        method: 'post',
        data
    });
};

// 查询道具列表
export const getPropList = (data: any) => {
    return request({
        url: '/member/api/prop/list',
        method: 'post',
        data
    });
};

// 分页查询道具
export const getPropPage = (params: any) => {
    return request({
        url: '/member/api/prop/page',
        method: 'get',
        params
    });
};

// 根据类型查询道具
export const getPropByType = (propType: string) => {
    return request({
        url: `/member/api/prop/type/${propType}`,
        method: 'get'
    });
};
